package com.atfcm.arr;

/**
 * @Author whaty
 * @create 2024/10/18 17:45
 */
public class t189 {
    public static void main(String[] args) {
        int[] a = {1, 2, 3, 4};
        rotate(a, 2);
        rever(a,0,a.length-1);
        System.out.println(3/2);
    }

    // 1 2 3 4
    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        rever(nums,0,nums.length-1);
        rever(nums,0,k%n-1);

        rever(nums,k%n,nums.length-1);


    }

    /**
     * 对称位置上元素交换
     * @param arr
     * @param start
     * @param end
     */
    public  static void rever(int[] arr,int start,int end){
        while (end > start){
            int temp = arr[start];
            arr[start] = arr[end];
            arr[end] = temp;
            start++;
            end--;
        }
    }

}